package com.yc.ioc.bean6_beanDefition;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @author zwei
 * @create 2024-07-29 10:11
 */
@Configuration
@ComponentScan
public class App1 {
    public static void main(String[] args) {
        //观察点   只创建容器的话   在prototype下 实例会创建吗  --不会
        ApplicationContext ac=new AnnotationConfigApplicationContext(App1.class);

        //在prototype下  每getBean一次创建一个对象
        Person p1= (Person) ac.getBean("person");
        Person p2=  ac.getBean("person",Person.class);
    }
}
